var file_table = function (){
    this.d_v = null;
}

file_table.prototype.pageInit = function () {
    var that =this;

    that.filetableVuInit();


    that.loadFileList(1,10,"");

}
file_table.prototype.filetableVuInit = function () {
    var that =this;
    let d_v = new Vue({
        el:"#tb_vu",
        data:{
            file_data:[],
            table_parm:null,
            files_total:null,
            file_size:10,
            file_page :1,
        },
        methods:{
        	re_file:function (index,res) {
          			layer.open({
						type: 1,
						offset: 'auto',
						title: "信息",
						content: '<div style="padding: 10px 10px">确定删除该文件吗？</div>',
						area: "auto",
						shade: 0.2,
						scrollbar: false,
						btn: ['是', '否'],
						yes: function () {
							that.delfile(res);
						}, btn2: function () {
							layer.closeAll();
						}
					})
        	},
        	edit_file:function (res){
        		that.updateFile(res);
        	},
				Change_fileSize:function (res) {
					this.file_size =res;
					that.loadFileList(this.file_size,this.file_page,this.table_parm);
				},Change_filepage:function(res) {
					this.file_page =res;
					that.loadFileList(this.file_size,this.file_page,this.table_parm);
				}
        }
    }) 
    that.d_v= d_v;

}

file_table.prototype.loadFileList = function (page,limit,parm) {
    var that = this;
    if (page == null || page == undefined ) {
    	page = "";
    }
      if (limit == null || limit == undefined ) {
    	limit = "";
    } 
    if (d_parm == null || d_parm == undefined ) {
    	d_parm = "";
    }
    var d_parm = {
		page:page,
		limit:limit,
		fileid:parm
    }
    
    $.ajax({
        type:"post",
        url:"/lvy/file/getfillall",
        data:JSON.stringify(d_parm),
        contentType:"application/json",
        success:function (res) {
           	that.d_v.file_data=res.rows;
           	that.d_v.files_total=res.total;
            that.d_v.file_size=limit;
           	that.d_v. file_page =page;

        }
    });


}

file_table.prototype.delfile = function (res) { 
		var that =this;
var d_parm = {
	fileid : [res.yfileid],
	fileurl: [res.fileurl]
}
    $.ajax({
        type:"post",
        url:"/lvy/file/rmFile",
        data:JSON.stringify(d_parm),
        contentType:"application/json",
        success:function (res) {
        	if (res) {
        		that.loadFileList(1,10,"");
        	}

        }
    });
}


file_table.prototype.updateFile = function (res) { 
		var that =this;
		
var d_parm = {
	fileid :[res.fileid]
}
//  $.ajax({
//      type:"post",
//      url:"/lvy/file/rmFile",
//      data:JSON.stringify(d_parm),
//      contentType:"application/json",
//      success:function (res) {
//		debugger;
//      }
//  });
}
